package bean;

import java.util.Calendar;

/**
 * Abstract bean which is used for customer and employee 
 * @author Martin Schophaus
 */
public abstract class Person {
	private String name;
	private String fname;
	private Adress adress;
	public Calendar birthday = null;
	
	public Person(){}
	
	public Person(String name, String fname, Adress adress) {
		this.setName(name);
		this.setFname(fname);
		this.setAdress(adress);
	}
	
	public Person(String name, String fname, Adress adress, Calendar birthday) {
		this(name, fname, adress);
		this.setBirthday(birthday);
	}
	
	public Calendar getBirthday() {
		return this.birthday;
	}

	public void setBirthday(Calendar birthday) {
		this.birthday = birthday;
	}

	public boolean isFullAged() {
		Calendar cal = Calendar.getInstance();
		long difference = System.currentTimeMillis() - this.getBirthday().getTimeInMillis();
		cal.setTimeInMillis(difference);
		if(cal.get(Calendar.YEAR) > 18) {
			return true;
		} else {
			return false;
		}
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getFname() {
		return fname;
	}

	public void setFname(String fname) {
		this.fname = fname;
	}

	public Adress getAdress() {
		return adress;
	}

	public void setAdress(Adress adress) {
		this.adress = adress;
	}
	
	
}
